// Cached.java
//
// Informatics 102 Spring 2012
// Code Example
//
// The @Cached annotation is placed on to a method whose results are to
// be cached.  When the @Cached annotation is used, it is required to
// have a "time to live" value associated with it, which specifies how
// long the result is to be cached for; after the result has been in the
// cache for that long, it will be replaced with a new value the next
// time the method is called.
//
// The interest thing about this annotation, relative to the ones we've
// seen previously, is that it is set up with a "retention policy."  An
// annotation's retention policy specifies how long it will exist.  There
// are three kinds of retention policies:
//
// * The annotation will be discarded by the compiler.  This is specified
//   by the SOURCE retention policy (i.e., the annotation exists in the
//   source code, but nowhere else).
// * The annotation will be saved into the compiled class file, but not
//   made available to the program at run-time.  This is specified by the
//   CLASS retention policy, which is also the default if a retention
//   policy isn't specified at all.
// * The annotation will be saved into the compiled class file and made
//   available to the program at run-time.  This is specified by the
//   RUNTIME retention policy.
//
// In this case, the annotation needs to survive until run-time so we can
// use the "time to live" to configure the behavior of a cache.  So we've
// marked this annotation with a retention policy of RUNTIME.

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;


@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Cached
{
	// Specifies the "time to live" in milliseconds
	int timeToLiveMillis();
}
